<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorator="/admin/_layouts/default">
<head>
    <title>新增城市信息</title>
</head>
<body>
<div layout:fragment="content">

        <!-- 内容区域 -->
        <section class="content">
            <!-- Small boxes (Stat box) -->
            <div class="row">
                <div class="col-xs-12 i-navbar">
                    <a class="btn btn-primary" th:href="@{/admin/weather/city/index.html}" data-pjax><i
                            class="fa fa-arrow-left"></i> 返回
                    </a>
                </div>
                <div class="col-xs-12">
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">新增城市信息</h3>
                        </div>
                        <!-- /.box-header -->
                        <!-- form start -->
                        <form id="systemVariableForm"
                              th:action="@{/admin/weather/city/insert}"
                              method="POST">
                            <div class="box-body">
                                <div class="form-group">
                                    <label for="code">编号 <span class="i-label label-warning">必填</span></label>
                                    <input class="form-control" id="code" name="code"
                                           placeholder="请输入编号"
                                           required
                                           type="text">
                                </div>
                                <div class="form-group">
                                    <label for="province">省 <span class="i-label label-warning">必填</span></label>
                                    <input class="form-control" id="province" name="province"
                                           placeholder="请输入省"
                                           required
                                           type="text">
                                </div>
                                <div class="form-group">
                                    <label for="city">市 <span class="i-label label-warning">必填</span></label>
                                    <input class="form-control" id="city" name="city"
                                           placeholder="请输入市"
                                           required
                                           type="text">
                                </div>
                                <div class="form-group">
                                    <label for="county">县 <span class="i-label label-warning">必填</span></label>
                                    <input class="form-control" id="county" name="county"
                                           placeholder="请输入县"
                                           required
                                           type="text">
                                </div>
                                <div class="form-group">
                                    <label for="longitude">经度 <span class="i-label label-warning">必填</span></label>
                                    <input class="form-control" id="longitude" name="longitude"
                                           placeholder="请输入经度"
                                           required
                                           type="text">
                                </div>
                                <div class="form-group">
                                    <label for="latitude">纬度 <span class="i-label label-warning">必填</span></label>
                                    <input class="form-control" id="latitude" name="latitude"
                                           placeholder="请输入纬度"
                                           required
                                           type="text">
                                </div>
                            </div>
                            <!-- /.box-body -->

                            <div class="box-footer">
                                <button class="btn btn-primary" type="submit">提交</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <!-- /.row -->
        </section>
        <!-- /内容区域 -->
        <script>
            $(function () {
                $('#systemVariableForm').ajaxForm({
                    dataType: 'json',
                    beforeSubmit: function (arr, form, option) {
                        form.find("button:submit").attr('disable', true);
                    },
                    success: function (data, statusText, xhr, form) {
                        if (data.code === 200) {
                            form.resetForm();
                            layer.msg(data.message);
                        } else {
                            layer.msg(data.message);
                        }
                        form.find("button:submit").attr('disable', false);
                    }
                })
            });
        </script>
    </div>
</body>
</html>
